$(function(){
/*
	$("img[id^='mc-'][state]").each(function(){
		var me = $(this);
		if(me.attr("state") == "open") {
			me.attr("src", basePath + "/web/resources/images/xt_07.jpg");
    		$("div[id^='cld'][id$='"+me.attr("id")+"']").show();
		} else {
			me.attr("src", basePath + "/web/resources/images/xt_29.jpg");
			$("div[id^='cld'][id$='"+me.attr("id")+"']").hide();
		}
	});
*/
	
	$("img[id^='mc-']").click(function(){
		var me = $(this);
		if(me.attr("state") == "open") {
			me.attr("state", "close");
			me.attr("src", basePath + "/web/resources/images/xt_29.jpg");
			$("div[id^='cld'][id$='"+me.attr("id")+"']:not([id^='cld0']").hide();
		} else {
			me.attr("state", "open");
			me.attr("src", basePath + "/web/resources/images/xt_07.jpg");
			$("div[id^='cld'][id$='"+me.attr("id")+"']:not([id^='cld0']").show();
		}
	});
	
	$(".jynr > div").mouseover(function(){
		$(this).addClass("select");
	}).mouseout(function(){
		$(this).removeClass("select");
	});
	
	initState();
});

function initState() {
	var imgs = $("img[id='" + openMenu + "']");
	var clds = $("div[id='" + selectMenu + "']");
	if(imgs.length == 1) {
		imgs.attr("state", "open");
		imgs.attr("src", basePath + "/web/resources/images/xt_07.jpg");
		$("div[id^='cld'][id$='"+imgs.attr("id")+"']:not([id^='cld0'])").show();
	}
	
	if(clds.length == 1) {
		clds.addClass("selected");
	}
}